home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Unix / satan-1.1.1 / bin / udpscan.satan < prev    next >
Text File  |  1996-04-24  |  967b  |  50 lines

  1. #!/usr/local/bin/perl
  2. #
  3. # version 1, Mon Mar 20 18:46:18 1995, last mod by wietse
  4. #
  5.  
  6. #
  7. # Report UDP services.
  8. #
  9. require 'config/paths.pl';
  10. require 'perl/misc.pl';
  11. require 'perllib/getopts.pl';
  12.  
  13. $usage = "usage $0 [-v] ports target";
  14.  
  15. &Getopts("v") || die $usage;
  16. die $usage unless ($#ARGV == 1);
  17.  
  18. ($services = $ARGV[0]) =~ tr /,/ /;
  19. $target = $ARGV[1];
  20.  
  21. $severity = "x";
  22. $status = "a";
  23.  
  24. $| = 1; 
  25.  
  26. open(SERVICES, $SERVICES) || die "$0: cannot open $SERVICES: $!\n";
  27. while (<SERVICES>) {
  28.     $service_name{$2} = $1 if /(\S+)\s+([0-9]+)\/udp/;
  29. }
  30.  
  31. $command = "$UDP_SCAN $target $services";
  32.  
  33. print "$command\n" if $opt_v;
  34.  
  35. open(UDP_SCAN, "$command|")
  36.     || die "$0: cannot run $UDP_SCAN";
  37.  
  38. while(<UDP_SCAN>) {
  39.     if (defined($opt_v)) {
  40.         print;
  41.     }
  42.     chop;
  43.     ($port, $service) = split(/:/, $_);
  44.     $service = $service_name{$port} if $service_name{$port};
  45.     if ($service eq "UNKNOWN") { $service = "$port:UDP"; }
  46.     $service_output = "";
  47.     $text = "offers $service";
  48.     &satan_print();
  49. }
  50.